#ifndef N1NOTIFICATIONCENTER_H_2006_06_26
#define N1NOTIFICATIONCENTER_H_2006_06_26

#include "N1Lib.h"

class N1String;

class N1NotificationRecord { 
public: 
    virtual void callFunction()=0; 
};

template<class T> 
class N1NotificationRecordTemplate : public N1NotificationRecord { 
public: 
    T *ptr;
    int (T::*function)(); 
    virtual void callFunction() { 
        (ptr->*function)();
    };
};


class NEXPORT N1NotificationCenter : public N1Object {
public:
    N1NotificationCenter(void);
    virtual ~N1NotificationCenter(void);

    template<class T> 
    void addFunction(N1String *notification, int(T::*function)()) 
    {
        T *ptr = static_cast<T*>(this); 
        if(ptr) 
            (ptr->*function)();
        I1<T> *pi1 = new I1<T>(); 
        pi1->ptr = ptr;
        pi1->function = function;
    }
};

#endif //N1NOTIFICATIONCENTER_H_2006_06_26
